﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using KerriganDirection.DirectionServiceWCF;
using System.Diagnostics;
using KerriganDirection.Helpers;
using KerriganDirection.SessionMgt;
using KerriganDirection.InstructorMgt;
using KerriganDirection.VehicleMgt;
using System.ComponentModel;

namespace KerriganDirection
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : INotifyPropertyChanged
    {
        #region NotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }

        #endregion

        #region Properties

        private MainModule _MainModuleVO;
        public MainModule MainModuleVO
        {
            get
            {
                return _MainModuleVO;
            }
            set
            {
                this._MainModuleVO = value;
                OnPropertyChanged("MainModuleVO");
            }
        }

        #endregion

        public MainWindow()
        {
            InitializeComponent();

            this.MainModuleVO = new MainModule();

            this.MainModuleVO.Init();
        }

        private void MainTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((sender as TabControl).SelectedIndex == 0)
            {
                this.MainModuleVO.ChangeUC(this.BottomDockPanel, this.MainModuleVO.SessionModuleVO.UcSessionOptionsVO);
            }
            else if ((sender as TabControl).SelectedIndex == 1)
            {
                this.MainModuleVO.ChangeUC(this.BottomDockPanel, this.MainModuleVO.InstructorModuleVO.UcInstructorOptionsVO);
            }
            else if ((sender as TabControl).SelectedIndex == 2)
            {
                this.MainModuleVO.ChangeUC(this.BottomDockPanel, this.MainModuleVO.VehicleModuleVO.UcVehicleOptionsVO);
            }
        }
    }
}
